package company.beike;

import java.util.Scanner;

public class BeiKe1A {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        String s = scan.next();
        char a[] = s.toCharArray();
        int count = 0, j = n - 1;
        boolean flag = false;
        for (int i = 0; i < j; i++) {
            for (int k = j; k >= i; k--) {
                if (i == k) {//没有找到相等的字符，分两种情况
                    if (n % 2 == 0 || flag) {
                        System.out.println("Impossible");
                        return;
                    }
                    flag = true;
                    count += (n / 2 - i);
                } else if (a[i] == a[k]) {//找到相等的字符就交换--交换到前边那个字符对应的后边的位置
                    for (int m = k; m < j; m++) {
                        //swap(a[m],a[m+1]);
                        char t = a[m];
                        a[m] = a[m + 1];
                        a[m + 1] = t;
                        count++;
                    }
                    j--;//字符位置成功对应，j--
                    break;//完成一次交换，跳出循环
                }

            }
        }
        System.out.println(count);
    }
}
